﻿@using com.hyrentals.webcommon.extensions
@using com.hyrentals.webportal.Config
@using com.hyrentals.data

@model com.hyrentals.data.RV
@{
    Html.AddStyle("css/rv");
    Html.AddTailScript("js/rv-interior");

    string calendarUrl = string.Format("/rv/{0}/edit/calendar", Model.Id);
    string pricingUrl = string.Format("/rv/{0}/edit/pricing", Model.Id);
    string overviewUrl = string.Format("/rv/{0}/edit/overview", Model.Id);
    string automotiveUrl = string.Format("/rv/{0}/edit/automotive", Model.Id);
    string interiorUrl = string.Format("/rv/{0}/edit/interior", Model.Id);
    string photosUrl = string.Format("/rv/{0}/edit/photos", Model.Id);
    string addressUrl = string.Format("/rv/{0}/edit/address", Model.Id);

    double? spaceWidth = Model.Interior == null ? null : Model.Interior.SpaceWidth;
    double? spaceLength = Model.Interior == null ? null : Model.Interior.SpaceLenght;
    double? blackWaterTank = Model.Interior == null ? null : Model.Interior.BlackWaterTank;
    double? greyWaterTank = Model.Interior == null ? null : Model.Interior.GreyWaterTank;
    double? freshWaterTank = Model.Interior == null ? null : Model.Interior.FreshWaterTank;
    double? waterHeater = Model.Interior == null ? null : Model.Interior.WaterHeater;
    double? propaneTanks = Model.Interior == null ? null : Model.Interior.PropaneTanks;
}

<div class="layout-primary">
    <div class="layout-primary-left">
        <ul class="manage-rv-nav">
            <li><a href="@calendarUrl">Calendar</a></li>
            <li><a href="@pricingUrl">Pricing</a></li>
            <li><a href="@overviewUrl">Overview</a></li>
            <li><a class="active" href="@automotiveUrl">RV Details</a></li>
            <li><a href="@photosUrl">Photos</a></li>
            <li><a href="@addressUrl">Address</a></li>
        </ul>
    </div>
    <div class="layout-primary-middle">
        <ul class="rv-detail-nav clearfix">
            <li><a href="@automotiveUrl">Automotive</a></li>
            <li><a class="active" href="@interiorUrl">Interior</a></li>
        </ul>
        <form id="J_Interior" class="form-s2 form-rv-interior" action="" method="post">
            <div class="valid-simple">
                <input type="hidden" value="@Model.Id" name="id"/>
                <div class="section space-section">
                    <h2>Space</h2>
                    <hr />
                    <div class="row clearfix">
                        <label for="sleeps" class="label">Sleeps</label>
                        <select id="sleeps" class="select" name="sleeps" data-msgbox="#msg_sleeps">
                         @{
                            for (int i = 10; i > 0; --i)
                            {
                                if(i == Model.Sleeps)
                                {
                                    <option value="@i" selected="selected">@i</option>
                                }
                                else
                                {
                                    <option value="@i">@i</option>
                                }
                            }
                        }
                        </select>
                        <span class="unit">People</span>
                        <span id="msg_sleeps" style="display: none;"></span>
                    </div>
                    <div class="row clearfix">
                        <label for="width" class="label">Width</label>
                        <input id="width" class="input-text" type="text" name="width" value="@spaceWidth" data-msgbox="#msg_width"/>
                        <span class="unit">FT</span>
                        <span id="msg_width" style="display: none;"></span>
                    </div>
                    <div class="row clearfix">
                        <label for="length" class="label">Length</label>
                        <input id="length" class="input-text" type="text" name="length" value="@spaceLength" data-msgbox="#msg_length"/>
                        <span class="unit">FT</span>
                        <span id="msg_length" style="display: none;"></span>
                    </div>
                </div>
                <div class="section tank-section">
                    <h2>Tank Capacities</h2>
                    <hr />
                    <div class="row clearfix">
                        <label for="black_water_tank" class="label">Black Water Tank</label>
                        <input id="black_water_tank" class="input-text" type="text" name="blackWaterTank" value="@blackWaterTank" data-msgbox="#msg_black_water_tank"/>
                        <span class="unit">GAL</span>
                        <span id="msg_black_water_tank" style="display: none;"></span>
                    </div>
                    <div class="row clearfix">
                        <label for="grey_water_tank" class="label">Grey Water Tank</label>
                        <input id="grey_water_tank" class="input-text" type="text" name="greyWaterTank" value="@greyWaterTank" data-msgbox="#msg_grey_water_tank"/>
                        <span class="unit">GAL</span>
                        <span id="msg_grey_water_tank" style="display: none;"></span>
                    </div>
                    <div class="row clearfix">
                        <label for="fresh_water_tank" class="label">Fresh Water Tank</label>
                        <input id="fresh_water_tank" class="input-text" type="text" name="freshWaterTank" value="@freshWaterTank" data-msgbox="#msg_fresh_water_tank"/>
                        <span class="unit">GAL</span>
                        <span id="msg_fresh_water_tank" style="display: none;"></span>
                    </div>
                    <div class="row clearfix">
                        <label for="water_heater" class="label">Water Heater</label>
                        <input id="water_heater" class="input-text" type="text" name="waterHeater" value="@waterHeater" data-msgbox="#msg_water_heater"/>
                        <span class="unit">GAL</span>
                        <span id="msg_water_heater" style="display: none;"></span>
                    </div>
                    <div class="row clearfix">
                        <label for="propane_tanks" class="label">Propane Tanks</label>
                        <input id="propane_tanks" class="input-text" type="text" name="propaneTanks" value="@propaneTanks" data-msgbox="#msg_propane_tanks"/>
                        <span class="unit">GAL</span>
                        <span id="msg_propane_tanks" style="display: none;"></span>
                    </div>
                </div>
                <div class="section chk-group">
                    <h2>Kitch and Bathroom</h2>
                    <hr />
                    <div class="clearfix">
                    @{
                        foreach (RVInteriorKitchBathroomFeatureEnum kitchBathroomFeature in Enum.GetValues(typeof(RVInteriorKitchBathroomFeatureEnum)))
                        {
                            byte index = (byte)kitchBathroomFeature;
                            string name = NameMapping.RVInteriorKitchBathroomFeatureEnumNameArray[index];
                            string id = string.Format("kitch_bath_{0}", index);
                            bool isChecked = Model.ContainKitchBathroomFeature(kitchBathroomFeature);
                            <label for="@id">
                            @{
                                   if (isChecked)
                                   {
                                    <input type="checkbox" value="@index" id="@id" name=" kitchBathroomFeatures" checked="checked"/>
                                   }
                                   else
                                   {
                                    <input type="checkbox" value="@index" id="@id" name="kitchBathroomFeatures"/>
                                   }
                            }
                                <span>@name</span>
                            </label>
                        }
                    }
                </div>
                </div>
                <div class="section chk-group">
                    <h2>Beds</h2>
                    <hr />
                    <div class="clearfix">
                    @{
                        foreach (RVInteriorBedFeatureEnum bedFeature in Enum.GetValues(typeof(RVInteriorBedFeatureEnum)))
                        {
                            byte index = (byte)bedFeature;
                            string name = NameMapping.RVInteriorBedFeatureEnumNameArray[index];
                            string id = string.Format("bed_{0}", index);
                            bool isChecked = Model.ContainBedFeature(bedFeature);
                            <label for="@id">
                            @{
                                   if (isChecked)
                                   {
                                    <input type="checkbox" value="@index" id="@id" name="bedFeatures" checked="checked"/>
                                   }
                                   else
                                   {
                                    <input type="checkbox" value="@index" id="@id" name="bedFeatures"/>
                                   }
                            }
                                <span>@name</span>
                            </label>
                        }
                    }
                </div>
                </div>
                <div class="section clearfix">
                    <a id="J_Sumbit" href="javascript:;" class="btn btn-large submit">Save</a>
                </div>
            </div>
        </form>
    </div>
    <div class="layout-primary-right"></div>
</div>